function [stego, em_msg, n_msg_bits] = STC_EMBED(cover, rho_P1, rho_M1, payload)
wet_cost = 10^13;
h = 10;
cover = int32(cover);
[r, t] = size(cover);

rho_P1(cover==255) = wet_cost; 
rho_M1(cover==0) = wet_cost; 
rho_P1 = reshape(rho_P1, 1, r * t);
rho_M1 = reshape(rho_M1, 1, r * t);

m = floor(r * t * payload); 
msg = uint8(rand(1, m));
em_msg = msg;

costs = zeros(3, r*t, 'single'); 
costs(1,:)=rho_M1;
costs(2,:)=0;
costs(3,:)=rho_P1;

cover_vector = reshape(cover,[1 r*t]);
[~, stego_vector, n_msg_bits, ~ ]...
    = stc_pm1_pls_embed(cover_vector, costs, msg, h);
stego = reshape(stego_vector, r, t);

